import subprocess
import psutil
import time
import sys

plist = [p for p in psutil.get_process_list() if p.name=='jcomm.exe']
if len(plist) > 0:
	print 'Jupiter has been running!'
	sys.exit(0)

jc = subprocess.Popen('jcomm.exe')

while True:
	time.sleep(3)

	try:
		pjc = psutil.Process(jc.pid)
	except psutil.NoSuchProcess:
		print 'No JComm!'
		jc = subprocess.Popen('jcomm.exe')
	except psutil.AccessDenied:
		print 'Access JComm Denied!'
	except psutil.TimeoutExpired:
		print 'Access JComm Timeout!'
